#ifndef IDLEPROCCESSING_H
#define IDLEPROCCESSING_H

#include <QThread>
#include <QTimer>

class IdleObject : public QObject {
    QTimer myTimer;
public:
    IdleObject() {
        connect( &myTimer, SIGNAL(timeout()), this, SLOT(onTimeOut()));
    }

    ~IdleObject() {
    }

public slots:
    void onSuspend() {
            myTimer.stop();
    }

    void onResume() {
            myTimer.start(0);
    }

    void onTimeOut() {
            // do a few comutation steps.
            // Should return "quickly" to the event loop
    }

};


class MyThread : public QThread // .start( QThread::IdlePriority );
{
public slots:
    run() {
        IdleObject idleObject; //=> the threadObject affinity is the thread
        // here, connect the appropriate signals to the appropriate slots

        idleObject.onResume();
        exec();
    }

}

#endif // IDLEPROCCESSING_H
